# from app.models import User
# from app.schemas import UserResponse
# from app.database import SessionLocal
# import bcrypt
#
# async def register_user(user: UserRegister):
#     # 对密码进行哈希处理（使用bcrypt库示例）
#     hashed_password = bcrypt.hashpw(user.password.encode('utf-8'), bcrypt.gensalt())
#     # 创建数据库会话
#     db = SessionLocal()
#     try:
#         new_user = User(username=user.username, password=hashed_password.decode('utf-8'), email=user.email)
#         db.add(new_user)
#         db.commit()
#         db.refresh(new_user)
#         return UserResponse(**new_user.__dict__)
#     finally:
#         db.close()